import * as api from '@/utils/api.js'
const state={
    searchInfo:{}
};
const mutations={
    SEARCHINFO(state,searchInfo){
      state.searchInfo=searchInfo
    }
};
const actions={
  async reqGetSearchInfo({commit},params){
    const {data:res}= await api.reqGetSearchInfo(params)
      commit("SEARCHINFO",res)
  }
};
//为了简化数据,为了能在页面中直接拿到这个值
const getters={
  goodsList(state){
   return state.searchInfo.goodsList || [] //避免在遍历的时候报错
  },
  trademarkList(state){
    return state.searchInfo.trademarkList || []
  },
  attrsList(state){
    return state.searchInfo.attrsList || []
  }
};
export default{
    state,
    mutations,
    actions,
    getters
}
